DIR_INC = ../inc
DIR_OBJ = ../obj
DIR_BIN = ../bin
DIR_SRC = ../src
TARGET = ${DIR_BIN}/main

SRC = $(wildcard ${DIR_SRC}/*.c)
OBJ = $(patsubst %.c,${DIR_OBJ}/%.o,$(notdir ${SRC}))

#@all:
#	@echo $(SRC)
#	@echo $(OBJ)
CC = gcc
CFLAG = -c -g -Wall -I${DIR_INC}
LDFLAG = -lpthread -lm
${TARGET}:${OBJ}
	@echo 'Building target:$@'
	${CC} $^ -o $@ ${LDFLAG}
	@echo 'Finished building target:$@'

${DIR_OBJ}/%.o:$(DIR_SRC)/%.c
	${CC}  -o $@ ${CFLAG} $< 

.PHONY:
clean:
	@echo 'Make $@'
	rm -rf ${DIR_OBJ}/*.o $(TARGET)
	@echo 'Finished' make $@

